<?php
namespace AiSPRDocManager\Model\Db;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of CvManager
 *
 * @author Asfer <rmasfer@gmail.com>
 */
class CvManager {

	public function insert ($sTableName, $aData) {
		$sMessage = '';

		global $wpdb;

		try {
			$mStatus = $wpdb->insert($sTableName, $aData);

			return $mStatus;
		}
		catch (Exception $oException) {
			$sMessage = 'Error occured while writing in database';

			return $sMessage;
		}
	}

	public function fetchAll ($sTableName) {
		$sMessage = '';
		global $wpdb;

		$sQuery = "SELECT * FROM `". $sTableName . "`";
		try {
			return $wpdb->get_results($sQuery, ARRAY_A);
		}
		catch (Exception $oException) {
			$sMessage = 'Something went wrong';
			return $sMessage;
		}
	}

	public function getAllModified ($sTableName) {
		$sMessage = '';
		global $wpdb;

		$sQuery = "SELECT * FROM `".$sTableName."` WHERE status = 1";

		try {
			return $wpdb->get_results($sQuery, ARRAY_A);
		}
		catch (Exception $oException) {
			$sMessage = 'Something went wrong';
			return $sMessage;
		}
	}



}

?>